<template>
  <div class="pollution-source-popup">
        <div class="popup-header">
      <h3>{{ featureData.name || '地图要素' }}</h3>
      <span class="close-btn" @click="closePopup">×</span>
    </div>
    <div class="popup-body">
      <div class="pollution-info">
        <!-- <div class="info-item">
          <label>企业名称:</label>
          <span>{{ featureData.polluteName || '未知' }}</span>
        </div> -->
        <div class="info-item">
          <label>行业:</label>
          <span>{{ featureData.industryTypeName || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>企业类型:</label>
          <span>{{ featureData.enterpriseType && this.enterpriseTypeMap ? (this.enterpriseTypeMap[featureData.enterpriseType]) : '未知' }}</span>
        </div>
        <div class="info-item">
          <label>企业状态:</label>
          <span>{{ featureData.epStateCode && this.epStateCodeMap ? (this.epStateCodeMap[featureData.epStateCode]) : '未知' }}</span>
        </div>
        <div class="info-item">
          <label>地址:</label>
          <span>{{ featureData.polluteAddress || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>经度:</label>
          <span>{{ featureData.longitude || featureData.lon || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>纬度:</label>
          <span>{{ featureData.latitude || featureData.lat || '未知' }}</span>
        </div>
        <div class="info-item">
          <label>是否涉水污染源:</label>


          <span>{{ featureData.waterRelate && this.waterRelateMap ? (this.waterRelateMap[featureData.waterRelate]) :
            '未知' }}</span>

        </div>


        <div class="info-item">
          <label>是否重点排污企业:</label>

          <span>{{ featureData.isGgarbageDisPlant && this.isGgarbageDisPlantMap ?
            (this.isGgarbageDisPlantMap[featureData.isGgarbageDisPlant]) : '未知' }}</span>

        </div>
        <div class="info-item">
          <label>是否畜牧养殖:</label>

          <span>{{ featureData.isAnimalHusbandry && this.isAnimalHusbandryMap ?
            (this.isAnimalHusbandryMap[featureData.isAnimalHusbandry]) : '未知' }}</span>
        </div>
        <div class="info-item">
          <label>是否畜禽养殖:</label>
          <span>{{ featureData.isBeastsFarm && this.isBeastsFarmMap ? (this.isBeastsFarmMap[featureData.isBeastsFarm]) :
            '未知' }}</span>
        </div>
        <div class="info-item">
          <label>是否污普企业:</label>
          <span>{{ featureData.ifWuPuEnt && this.ifWuPuEntMap ? (this.ifWuPuEntMap[featureData.ifWuPuEnt]) : '未知'
            }}</span>
        </div>
        <div class="info-item">
          <label>受纳水体:</label>
          <span>{{ featureData.riverName || '未知' }}</span>
        </div>

      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'PollutionSourcePopup',
  data: function () {
    return {
      waterRelateMap: {
        '1': '是',
        '0': '否'
      },
      epStateCodeMap: {
        //0关闭,1正常,2注销,3吊销,4停产,5搬迁,6其他
        '0': '关闭',
        '1': '正常',
        '2': '注销',
        '3': '吊销',
        '4': '停产',
        '5': '搬迁',
        '6': '其他'
      },
      enterpriseTypeMap: {
        // 0工业源 1农业源 2生活源 9其他 8工业园区
        '0': '工业源',
        '1': '农业源',
        '2': '生活源',
        '8': '工业园区',
        '9': '其他',
      },
      isGgarbageDisPlantMap: {
        '1': '是',
        '0': '否'
      },
      isAnimalHusbandryMap: {
        '1': '是',
        '0': '否'
      },
      isBeastsFarmMap: {
        '1': '是',
        '0': '否'
      },
      ifWuPuEntMap: {
        '1': '是',
        '0': '否'
      },
    };
  },
  props: {
    featureData: {
      type: Object,
      default: () => ({})
    }
  },

  methods: {
    closePopup() {
      this.$emit('close');
    }
  }
};
</script>

<style scoped>
.pollution-source-popup {
  min-width: 300px;
  max-width: 400px;
}

.popup-header {
  padding: 12px 16px;
  border-bottom: 1px solid #ebeef5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-header h3 {
  margin: 0;
  font-size: 16px;
  color: #303133;
}

.close-btn {
  cursor: pointer;
  font-size: 20px;
  color: #909399;
}

.close-btn:hover {
  color: #409eff;
}

.popup-body {
  padding: 16px;
}

.info-item {
  display: flex;
  margin-bottom: 10px;
  font-size: 14px;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-item label {
  width: 120px;
  color: #606266;
  font-weight: 500;
}

.info-item span {
  flex: 1;
  color: #303133;
}

.pollution-level {
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  font-weight: bold;
  font-size: 12px;
}
</style>